<div class="ui grid">
    <div class="four wide column"></div>
    <div class="eight wide column">
        <div class="ui segment">
            <div class="ui minimal comments">
                <h3 class="ui dividing header">留言</h3>

                <% comments.forEach(function (comment) { %>
                <div class="comment">
            <span class="avatar">
              <img src="/img/<%= comment.author.avatar %>">
            </span>
                    <div class="content">
                        <a class="author" href="/posts?author=<%= comment.author._id %>"><%= comment.author.name %></a>
                        <div class="metadata">
                            <span class="date"><%= comment.created_at %></span>
                        </div>
                        <div class="text"><%- comment.content %></div>

                        <% if (user && comment.author._id && user._id.toString() === comment.author._id.toString()) { %>
                        <div class="actions">
                            <a class="reply" href="/posts/<%= post._id %>/comment/<%= comment._id %>/remove">删除</a>
                        </div>
                        <% } %>
                    </div>
                </div>
                <% }) %>

                <% if (user) { %>
                <form class="ui reply form" method="post" action="/posts/<%= post._id %>/comment">
                    <div class="field">
                        <textarea name="content" required></textarea>
                    </div>
                    <input type="submit" class="ui icon button" value="留言" />
                </form>
                <% } %>

            </div>
        </div>
    </div>
</div>